package com.neusoft.wangrisheng.weektest;

public class Calculator {
	protected String x;
	protected String mark;
	protected String y;
	
	//给X赋值
	public String Xzhi(String x){
		this.x=x;
		return this.x=x;
	}
	//给mark赋值
	public  String Markzhi(String mark){
		this.mark=mark;
		return this.mark;
	}
	//给y赋值
	public String Yzhi(String y){
		this.y=y;
		return this.y=y;
	}
	//运算
	public void panduan(String str1,String str2,String str3) {
		Integer intstr1 = Integer.valueOf(str1);
		Integer intstr3 = Integer.valueOf(str3);
		
		if(str2.equals("+")){	
			System.out.println("X+Y="+(intstr1+intstr3));
		}else if(str2.equals("-")){	
			System.out.println("X-Y="+(intstr1-intstr3));
		}else if(str2.equals("*")) {
			System.out.println("X*Y="+(intstr1*intstr3));
		}else if(str2.equals("/")) {
			if(str3.equals("0")) {
				System.out.println("进行除法运算时，分母不能为0");
				return;
			}
			System.out.println("X/Y="+(intstr1/intstr3));
		}
	}
}
